package org.syntaxlisp.core.element;

/**
 * @author HuangYijun
 * @data 2023-01-29 11:05
 **/
public class ReferenceElement extends SyntaxLispElement {

    public ReferenceElement(String val) {
        super(SyntaxLispElementType.REF, val);
    }

    public boolean isSameRef (SyntaxLispElement target) {
        return SyntaxLispElementType.REF == target.getType()
                && getVal().equals(target.getVal());
    }

    @Override
    public boolean equalsTo(SyntaxLispElement o) {
        return getVal().equals(o.getVal());
    }

    @Override
    public int hashCode () {
        return getVal().hashCode();
    }

    @Override
    public SyntaxLispElement copy() {
        return (new ReferenceElement(getVal())).copyMatchPropertiesAndReturn(this);
    }
}
